<template>
  <div class="madp-tabs-view">
    <div class="left">
      <div class="scroll-view">
        <el-tabs v-model="leftTabIdx" tab-position="left" class="tabs-menu" @tab-click="handleLeftTab">
          <el-tab-pane v-for="(item, idx) in leftMenu" :label="item.name" :key="idx" :name="String(idx)"></el-tab-pane>
        </el-tabs>
      </div>
    </div>
    <div class="right">
      <div class="header" v-if="showRightTag">
        <el-tabs v-model="topTabIdx" tab-position="top" class="tabs-menu" @tab-click="handleTopTab">
          <el-tab-pane v-for="(item, idx) in topMenu" :label="item.name" :key="idx" :name="String(idx)"></el-tab-pane>
        </el-tabs>
      </div>
      <div class="container">
        <slot></slot>
      </div>
    </div>
  </div>
</template>
<script>
// 引入mescroll的vue组件
export default {
  name: 'mescrollMore',
  props: {
    leftMenu: {
      type: Array,
      default: []
    },
    topMenu: {
      type: Array,
      default: []
    },
    showRightTag: {
      type: Boolean,
      default: true
    }
  },
  components: {},
  data() {
    return {
      leftTabIdx: '0',
      topTabIdx: '0'
    }
  },
  created() {},
  mounted() {},
  watch: {},
  methods: {
    handleLeftTab(vm) {
      this.$emit('changeTab', { left: this.leftTabIdx, top: this.topTabIdx })
    },
    handleTopTab(vm) {
      this.$emit('changeTab', { left: this.leftTabIdx, top: this.topTabIdx })
    }
  }
}
</script>
<style lang="less" scoped>
* {
  margin: 0;
  padding: 0;
  font-size: 14px;
  box-sizing: border-box;
}

.madp-tabs-view {
  width: 100%;
  display: flex;
  .left {
    width: 79px;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid rgba(#2c2c2c, 0.1);
    .scroll-view {
      width: 100%;
      height: 100%;
      overflow: hidden;
      // overflow-y: scroll;
      scrollbar-width: none; /* firefox */
      -ms-overflow-style: none; /* IE 10+ */
    }
    .mescroll-view::-webkit-scrollbar {
      display: none; /* Chrome Safari */
    }
    .tabs-menu {
      width: 100%;
      /deep/.el-tabs__nav {
        width: 79px;
        .el-tabs__item {
          width: 100%;
          text-align: left;
          padding: 0 8px;
          font-size: 16px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #202020;
          height: 40px;
          line-height: 40px;
        }
        .is-active {
          font-family: PingFangSC-Semibold, PingFang SC;
          font-weight: 600;
          color: #ed5555;
        }
        .el-tabs__active-bar {
          height: 22px !important;
          width: 4px;
          margin: 9px 0;
          background: #ed5555;
        }
      }
      /deep/.el-tabs__nav-wrap::after {
        background: none;
      }
      /deep/.el-tabs__header {
        margin: 0;
      }
    }
  }
  .right {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    .header {
      border-bottom: 1px solid rgba(#2c2c2c, 0.1);
      .tabs-menu {
        width: 100%;
        /deep/.el-tabs__header {
          margin: 0;
        }
        /deep/.el-tabs__nav {
          width: 45px;
          display: flex;
          justify-content: space-between;
          width: 100%;
          .el-tabs__item {
            padding: 0;
            width: 100%;
            text-align: center;
            font-size: 14px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: rgba(44, 44, 44, 0.5);
          }
          .is-active {
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #2c2c2c;
          }
          .el-tabs__active-bar {
            display: flex;
            justify-content: center;
            background: none;
          }
          .el-tabs__active-bar:after {
            content: '';
            width: 16px;
            height: 4px;
            margin: 0 16px;
            background: #ed5555;
            border-radius: 8px;
            position: absolute;
            top: -2px;
          }
          .el-tabs__nav-wrap::after {
            background: none;
          }
        }
        /deep/.el-tabs__nav-wrap::after {
          background: none;
        }
      }
    }
    .container {
      width: 100%;
      flex: 1;
      overflow: hidden;
    }
  }
}
</style>